package com.basker.pisces.excel;

import java.io.File;
import java.io.InputStream;

import com.basker.pisces.excel.enums.WorkbookType;
import com.basker.pisces.spring.SpringApplicationContext;

/**
 * 创建excel工作簿的工厂接口
 *
 * @author hangwen
 */
public interface IWorkbookFactory {

    /**
     * 获取IWorkbookFactory的实例
     *
     * @return
     */
    public static IWorkbookFactory getInstance() {
        return SpringApplicationContext.getInstance().getBean(IWorkbookFactory.class);
    }

    /**
     * 新建excel工作簿
     *
     * @param type
     * @return
     */
    IWorkBook create(WorkbookType type);

    /**
     * 从文件加载excel工作簿
     *
     * @param file
     * @return
     */
    IWorkBook load(File file);

    /**
     * 从输入流加载excel工作簿
     *
     * @param inputStream
     * @return
     */
    IWorkBook load(InputStream inputStream);
}
